<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const properties = [
            "中华园,北京市,公寓",
            "华景苑,上海市,别墅",
            "新城市广场,深圳市,公寓",
            "雅居乐花园,广州市,别墅",
            "恒大城,广州市,公寓",
            "太阳花园,北京市,别墅"
        ];

        const getHouseStyle = (arr) => {
            const res = {}
            const data = arr.map((item) => item.split(','))
            data.forEach(([Name, , Style]) => {
                if (res[Style]) {
                    res[Style].push(Name)
                } else {
                    res[Style] = []
                    res[Style].push(Name)
                }
            })

            console.log(res)
        }

        getHouseStyle(properties)

        // function shujv(data){
        //     data.map((item)=>{
        //         const leixing=item.split(',').splice(2,1).join('')
        //        console.log( item.split(',').splice(0,1).join('').concat(leixing).split(','));
        //     })
        // }
//         shujv(properties)
//         let str = 'hello world';
// str = str.slice(0, 3).concat(str.slice(6)); // 删除'lo '
// console.log(str);
    </script>
</body>

</html>